-
Notifications
You must be signed in to change notification settings - Fork 80
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #579 +/- ##
==========================================
- Coverage 86.18% 85.74% -0.45%
==========================================
Files 117 117
Lines 5719 5758 +39
==========================================
+ Hits 4929 4937 +8
- Misses 790 821 +31
Continue to review full report at Codecov.
|
Script for demonstration: from typing import Tuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from etna.analysis import StatisticsRelevanceTable
from etna.analysis import plot_feature_relevance
from etna.datasets import TSDataset
def simple_df_relevance() -> Tuple[pd.DataFrame, pd.DataFrame]:
rng = np.random.default_rng(42)
timestamp = pd.date_range("2021-01-01", "2021-02-01")
df_1 = pd.DataFrame({"timestamp": timestamp, "target": np.arange(32), "segment": "1"})
df_2 = pd.DataFrame({"timestamp": timestamp[5:], "target": np.arange(5, 32), "segment": "2"})
df = pd.concat([df_1, df_2], ignore_index=True)
df = TSDataset.to_dataset(df)
timestamp = pd.date_range("2020-12-01", "2021-02-11")
df_1 = pd.DataFrame(
{
"timestamp": timestamp,
"regressor_1": np.arange(len(timestamp)),
"regressor_2": np.zeros(len(timestamp)),
"regressor_3": rng.normal(loc=0, scale=1.0, size=len(timestamp)),
"regressor_4": rng.uniform(low=0, high=10.0, size=len(timestamp)),
"regressor_5": rng.exponential(scale=1.0, size=len(timestamp)),
"cat_feature": "hello",
"segment": "1",
}
)
df_2 = pd.DataFrame(
{
"timestamp": timestamp[5:],
"regressor_1": np.sin(-np.arange(len(timestamp) - 5)),
"regressor_2": np.log(np.arange(1, len(timestamp) - 4)),
"regressor_3": rng.normal(loc=0, scale=2.0, size=len(timestamp) - 5),
"regressor_4": rng.uniform(low=0, high=5.0, size=len(timestamp) - 5),
"regressor_5": rng.exponential(scale=0.1, size=len(timestamp) - 5),
"cat_feature": "bye",
"segment": "2",
}
)
df_exog = pd.concat([df_1, df_2], ignore_index=True)
df_exog = TSDataset.to_dataset(df_exog)
return df, df_exog
df, df_exog = simple_df_relevance()
ts = TSDataset(df=df, df_exog=df_exog, known_future="all", freq="D")
relevance_table = StatisticsRelevanceTable()
plot_feature_relevance(
ts=ts,
relevance_table=relevance_table,
normalized=False,
relevance_aggregation_mode="per-segment",
top_k=None,
segments=None,
columns_num=2,
figsize=(10, 5),
)
plt.savefig("per-segment.png")
plot_feature_relevance(
ts=ts,
relevance_table=relevance_table,
normalized=False,
relevance_aggregation_mode="mean",
top_k=None,
segments=None,
columns_num=2,
figsize=(10, 5),
)
plt.savefig("mean.png") |
alex-hse-repository
suggested changes
Mar 9, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May you also try to test this method in the different combinations of the parameters(different relevance tables, normalization, top_k, aggregation mod)
# Conflicts: # CHANGELOG.md # etna/analysis/plotters.py
alex-hse-repository
approved these changes
Mar 10, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IMPORTANT: Please do not create a Pull Request without creating an issue first.
Before submitting (must do checklist)
Type of Change
Proposed Changes
Look #564.
Related Issue
#564.
Closing issues
Closes #564.